class YueModel {
  int code;
  String msg;
  YueDataListModel? data;

  YueModel({
    this.code = 0,
    this.msg = "",
    this.data,
  });

  factory YueModel.fromJson(Map<String, dynamic> json) {
    return YueModel(
      code: json['code'] ?? 0,
      msg: json['msg'] ?? '',
      data: json['data'] != null ? YueDataListModel.fromJson(json['data']) : null,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'code': code,
      'msg': msg,
      'data': data?.toJson(),
    };
  }
}

class YueDataListModel {
  String balance;
  YuePageModel? page;

  YueDataListModel({
    this.balance = "",
    this.page,
  });

  factory YueDataListModel.fromJson(Map<String, dynamic> json) {
    return YueDataListModel(
      balance: json['balance'] ?? '',
      page: json['page'] != null ? YuePageModel.fromJson(json['page']) : null,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'balance': balance,
      'page': page?.toJson(),
    };
  }
}

class YuePageModel {
  List<YueListModel> records;

  YuePageModel({
    this.records = const [],
  });

  factory YuePageModel.fromJson(Map<String, dynamic> json) {
    return YuePageModel(
      records: (json['records'] as List)
          .map((item) => YueListModel.fromJson(item))
          .toList(),
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'records': records.map((item) => item.toJson()).toList(),
    };
  }
}

class YueListModel {
  String createTime;
  double currentAmount;
  double currentBalance;
  String reason;
  int type;

  YueListModel({
    this.createTime = "",
    this.currentAmount = 0.0,
    this.currentBalance = 0.0,
    this.reason = "",
    this.type = 0,
  });

  factory YueListModel.fromJson(Map<String, dynamic> json) {
    return YueListModel(
      createTime: json['createTime'] ?? '',
      currentAmount: (json['currentAmount'] as num?)?.toDouble() ?? 0.0,
      currentBalance: (json['currentBalance'] as num?)?.toDouble() ?? 0.0,
      reason: json['reason'] ?? '',
      type: json['type'] ?? 0,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'createTime': createTime,
      'currentAmount': currentAmount,
      'currentBalance': currentBalance,
      'reason': reason,
      'type': type,
    };
  }
}


class GroupDataModel {
  int code;
  String msg;
  List<GroupClassModel> data;

  GroupDataModel({
    required this.code,
    required this.msg,
    required this.data,
  });

  // 手动实现 fromJson 方法
  factory GroupDataModel.fromJson(Map<String, dynamic> json) {
    return GroupDataModel(
      code: json['code'] ?? 0,
      msg: json['msg'] ?? '',
      data: (json['data'] as List<dynamic>?)
              ?.map((e) => GroupClassModel.fromJson(e))
              .toList() ??
          [],
    );
  }

  // 手动实现 toJson 方法
  Map<String, dynamic> toJson() {
    return {
      'code': code,
      'msg': msg,
      'data': data.map((e) => e.toJson()).toList(),
    };
  }
}

class GroupClassModel {
  String categoryName;
  List<GroupListModel> data;

  GroupClassModel({
    required this.categoryName,
    required this.data,
  });

  // 手动实现 fromJson 方法
  factory GroupClassModel.fromJson(Map<String, dynamic> json) {
    return GroupClassModel(
      categoryName: json['categoryName'] ?? '',
      data: (json['data'] as List<dynamic>?)
              ?.map((e) => GroupListModel.fromJson(e))
              .toList() ??
          [],
    );
  }

  // 手动实现 toJson 方法
  Map<String, dynamic> toJson() {
    return {
      'categoryName': categoryName,
      'data': data.map((e) => e.toJson()).toList(),
    };
  }
}

class GroupListModel {
  String categoryName;
  String? memberNumber;
  String? memberNickName;
  int itemId;
  int id;

  GroupListModel({
    required this.categoryName,
    this.memberNumber,
    this.memberNickName,
    required this.itemId,
    required this.id,
  });

  // 手动实现 fromJson 方法
  factory GroupListModel.fromJson(Map<String, dynamic> json) {
    return GroupListModel(
      categoryName: json['categoryName'] ?? '',
      memberNumber: json['memberNumber'],
      memberNickName: json['memberNickName'],
      itemId: json['itemId'] ?? 0,
      id: json['id'] ?? 0,
    );
  }

  // 手动实现 toJson 方法
  Map<String, dynamic> toJson() {
    return {
      'categoryName': categoryName,
      'memberNumber': memberNumber,
      'memberNickName': memberNickName,
      'itemId': itemId,
      'id': id,
    };
  }
}

class GroupListDataModel {
  int code;
  String msg;
  List<GroupListModel> data;

  GroupListDataModel({
    required this.code,
    required this.msg,
    required this.data,
  });

  // 手动实现 fromJson 方法
  factory GroupListDataModel.fromJson(Map<String, dynamic> json) {
    return GroupListDataModel(
      code: json['code'] ?? 0,
      msg: json['msg'] ?? '',
      data: (json['data'] as List<dynamic>?)
              ?.map((e) => GroupListModel.fromJson(e))
              .toList() ??
          [],
    );
  }

  // 手动实现 toJson 方法
  Map<String, dynamic> toJson() {
    return {
      'code': code,
      'msg': msg,
      'data': data.map((e) => e.toJson()).toList(),
    };
  }
}

